//
//  tabViewController.m
//  bookKTVMerchant
//
//  Created by edz on 2019/7/22.
//  Copyright © 2019年 edz. All rights reserved.
//

#import "tabViewController.h"
#import "naviViewController.h"
#import "threeViewController.h"
#import "homeViewController.h"
#import "secondViewController.h"
@interface tabViewController ()

@end

@implementation tabViewController
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setUpChildcontroller];
}
- (void)setUpChildcontroller{
    
    [self.tabBar setTranslucent:NO ];

    [self addchildViewController:[[homeViewController alloc]init] Title:@"首页" Imaga:@"home" SelectImage:@"selecthome"];

     [self addchildViewController:[[secondViewController alloc]init] Title:@"课程" Imaga:@"second" SelectImage:@"selectsecond"];

     [self addchildViewController:[[threeViewController alloc]init] Title:@"个人中心" Imaga:@"three" SelectImage:@"selectthree"];
//
//    [self addchildViewController:[[fourViewController alloc]init] Title:@"个人中心" Imaga:@"four" SelectImage:@"selectfour"];

    self.tabBar.tintColor = [UIColor colorWithRed:26/255.0 green:74/255.0 blue:199/255.0 alpha:1.0];
//    self.tabBar.tintColor =[UIColor colorWithRed:72/255.0 green:207/255.0 blue:191/255.0 alpha:1.0];

    
}
- (void)addchildViewController:(UIViewController *)viController Title:(NSString *)title Imaga:(NSString *)image SelectImage:(NSString *)selectImgae {
    viController.tabBarItem.title = title;
    viController.tabBarItem.image = [UIImage imageNamed:image];
    UIImage *selcetImage1 = [[UIImage imageNamed:selectImgae]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    viController.tabBarItem.selectedImage = selcetImage1;
    
    naviViewController *nav = [[naviViewController alloc]initWithRootViewController:viController];
    [self addChildViewController:nav];
   
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/




@end
